package servlets;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import dao.DonateDao;
import dao.Fundraising_projectDao;

import bean.Donate;

public class ModifyDonateServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String id = req.getParameter("id");

		HttpSession session = req.getSession();
		String choice_id = (String) session.getAttribute("choice_id");

		Donate modifyDonate = new DonateDao().getContent(id);
		ArrayList<String> project_title_list = new Fundraising_projectDao().getAllTitles();

		session.setAttribute("modifyDonate", modifyDonate);
		session.setAttribute("project_title_list", project_title_list);
		
		session.setAttribute("find_insert_id", 6);
		resp.sendRedirect("houtai/guanli_1.jsp?id=" + choice_id);

	}
}
